package cn.shutdown.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.shutdown.dao.IUserDao;
import cn.shutdown.po.User;
import cn.shutdown.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {
	
	@Autowired
	private IUserDao userDao;

	public boolean hasUser(String userName) {
		return false;
	}

	public void registUser(User user) {
		userDao.insert(user);
	}

	public User loginUser(User user) {
		return this.userDao.matchUser(user);
	}

	public User getUserById(int userId) {
		return this.userDao.selectByPrimaryKey(userId);
	}

	public User matchUser(String userName, String password) {
		User user = new User();
		user.setUserName(userName);
		user.setPassword(password);
		return userDao.matchUser(user);
	}

}
